package demo02;

import java.util.Random;

//把二维数组打乱arr={{1,2},{3,4,5,6},{7,8,9,10}}
public class HomeWork04 {
    public static void main(String[] args){
        int [] [] arr={{1,2},{3,4,5,6},{7,8,9,10}};
        Random r=new Random();
        for(int i=0;i<arr.length;i++){
            for(int j=0;j<arr[i].length;j++){
                int sc=r.nextInt(arr.length-1);
                int sc2=r.nextInt(arr[sc].length-1);
                int temp=arr[i][j];
                arr[i][j] =arr[sc][sc2];
                arr[sc][sc2] =temp;
            }
        }
        for(int i=0;i<arr.length;i++){
            System.out.print("{");
            for(int j=0;j<arr[i].length;j++){
                if(j==arr[i].length-1){
                    System.out.print(arr[i][j]);
                }
                else{
                    System.out.print(arr[i][j]+",");
                }
            }
            if(i==arr.length-1){
                System.out.print("}");
            }
            else{
                System.out.print("},");
            }
        }
    }
}